
package de.gwtprime.server.servlets;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

/**
 * 
 * @author jan
 *
 */
public abstract class LoginSuperServlet extends HttpServlet {

	private static final long serialVersionUID = -3521128639845915873L;

	protected String buildCallBackURL(HttpServletRequest request, Integer provider) {
		StringBuffer requestURL = request.getRequestURL();
		String callbackURL = requestURL.toString();
		callbackURL += "callback";
		
		return callbackURL;
	}
	
	/**
	 * Store the last location in the session. This is used after the 
	 * login to go back to the last page.
	 * @param request
	 */
	protected void storeLastPageToSession(HttpServletRequest request) {
		
		request.getSession().setAttribute("lastPage", "#"+request.getParameter("lastPage"));
	}

}